package io.bsly.modules.app.controller;

import io.bsly.common.utils.R;
import io.bsly.modules.app.annotation.JwtIgnore;
import io.bsly.modules.app.entity.localEntity.DyCompanyEntity;
import io.bsly.modules.app.service.localmaster.DyCompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
/**
 * 公司信息
 *
 * @author fys
 * @date 2021-09-30 15:37:44
 */
@Api(tags = "公司信息")
@RestController
@RequestMapping("app/dycompany")
public class DyCompanyController {
    @Autowired
    private DyCompanyService dyCompanyService;

    /**
     * 信息
     */
    @JwtIgnore
    @ApiOperation(value = "根据id查询记录")
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		DyCompanyEntity dyCompany = dyCompanyService.getById(id);

        return R.ok().put("dyCompany", dyCompany);
    }

    /**
     * 保存
     */
    @JwtIgnore
    @PostMapping("/save")
    @ApiOperation(value = "保存接口")
    public R save(@RequestBody DyCompanyEntity dyCompany){
		dyCompanyService.save(dyCompany);
        return R.ok();
    }

    /**
     * 修改
     */
    @JwtIgnore
    @PostMapping("/update")
    @ApiOperation(value = "修改")
    public R update(@RequestBody DyCompanyEntity dyCompany){
		dyCompanyService.updateById(dyCompany);
        return R.ok();
    }

    /**
     * 删除
     */
    @JwtIgnore
    @ApiOperation(value = "删除")
    @DeleteMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		dyCompanyService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
